﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dominio
{
    public class Video
    {
        public int Id { get; set; }
        public string Titulo { get; set; }
        public List<Evento> Eventos { get; set; }
        public string FilePath { get; set; }


        public Video() { }

        public override bool Equals(object obj)
        {
            if (Object.ReferenceEquals(this, obj)) return true;

            if (Object.ReferenceEquals(obj, null))
                return false;

            if (!Type.Equals(this,obj))
                return false;

            return this.Id.Equals(((Video)obj).Id);
        }       

        public override int GetHashCode()
        {
            if (Object.ReferenceEquals(this, null)) return 0;

            int hashVideoId = this.Id.GetHashCode();
            return hashVideoId;
        }
    }

    public class VideoComparer : IEqualityComparer<Video>
    {

        public bool Equals(Video x, Video y)
        {
            if (Object.ReferenceEquals(x, y)) return true;

            if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null))
                return false;

            return x.Id.Equals(y.Id);
        }

        public int GetHashCode(Video video)
        {
            if (Object.ReferenceEquals(video, null)) return 0;

            int hashVideoId = video.Id.GetHashCode();
            return hashVideoId;
        }

    }
}
